import tkinter as tk
def triangle_1(x):
    triangle = [[1], [1, 1]] 
    n = 3 
    while n <= x:
        for i in range(0, n-1):
            if i == 0:
                triangle.append([1,1])
            else:
                triangle[n-1].insert(i, triangle[n - 2][i] + triangle[n - 2][i - 1])
        n += 1
    return triangle

trian = triangle_1(10)
top = tk.Tk()
top.title('Hello Tk')
ipx = 2
top.resizable(True, True)
frames = []
for i in range(len(trian)):
    f = tk.Frame(top)
    f.pack(side = tk.TOP, fill = tk.X)
    frames.append(f)

for i in range(0,len(trian)):
    for j in trian[i]:
        info = str(j) + ' '
        # label = tk.Label(frames[i - 1], width = 9, text = info, relief = tk.SUNKEN, anchor='w')
        label = tk.Label(frames[i], width = 10, text = info, relief = tk.SUNKEN)
        label.pack(side = tk.LEFT, ipadx = ipx, padx = 1)

top.mainloop()

